{% extends "base.volt" %}

{% block pageFooter%}
    <script type="text/javascript">
        var domainPic = '{{ this.di.get('appConfig').application.domainPic }}';
        var picUploadUrl = '{{ url.get('tools/editorPTUploadImg', ['callback':'parent.setFormResultImg', 'type':'banner']) }}';
    </script>
    {{ javascript_include("/libs/UEditor/utf8-php/ueditor.config.js", false) }}
    {{ javascript_include("/libs/UEditor/utf8-php/ueditor.all.min.js", false) }}
    {{ javascript_include("/libs/UEditor/utf8-php/lang/zh-cn/zh-cn.js", false) }}
    {{ javascript_include("/assets/manage/js/om/bannerEdit.js", false) }}
{% endblock %}

{% block content %}
    {{ partial("module/left_om") }}
    <div class="col-xs-10">
        <ol class="breadcrumb">
            <li>Banner位管理</li>
            <li class="active">修改Banner</li>
        </ol>
	
            <form id="form_update" durl="{{url.get('om/bannerList')}}"  class="form-horizontal" role="form" method="post" action="" target="ifr_send_file" enctype="multipart/form-data">
            <input type="hidden" name="callback" value="parent.setFormResult">
            <input type="hidden" name="banner_id" value="{{info.banner_id}}">
            
            <div class="form-group">
                <label for="city_id" class="col-xs-2 control-label">城市</label>
                <div class="col-xs-2">
                    <label class="control-label">
                {% if info.city_id == 0 %}
            		全国
            	{%else%}
            		{% for oc in openCity %}
            			{% if info.city_id == oc.city_id %}
            				{{oc.city_name}}
            			{%endif%}
            		{% endfor %}	
            	{%endif%}
                    <!-- <select class="form-control" id="city_id" name="city_id" data-rule="required;">
                        {% for oc in openCity %}
                            <option value="{{ oc.city_id }}" {{ info.city_id == oc.city_id ? 'selected="selected"' : '' }}>{{ oc.city_name|e }}</option>
                        {% endfor %}
                    </select> -->
                    </label>
                </div>
            </div>
            
            <div class="form-group">
                <label for="banner_name" class="col-xs-2 control-label">类型</label>
                <div class="col-xs-9">
                    <select class="form-control item_link_type" name="banner_name" id="banner_name">
                        <option value="1" {{ info.banner_name == 1 ? 'selected="selected"' : '' }}>首页</option>
                        <option value="2" {{ info.banner_name == 2 ? 'selected="selected"' : '' }}>问答</option>
                        <option value="3" {{ info.banner_name == 3 ? 'selected="selected"' : '' }}>美容院</option>
                    </select>
                </div>
            </div>
            
            <div class="form-group">
                <label for="banner_cover" class="col-xs-2 control-label">封面</label>
                <div class="col-xs-9"> 
                	<img style="width:400px;height:200px;" src="{{ this.di.get('appConfig').application.domainPic }}{{ bannerData['url'] }}"/>                
                    <input type="file" class="form-control" id="banner_cover" name="banner_cover">
                    <p id="imgInfo" class="help-block">*支持JPG，PNG，JPEG格式的图片，大小不超过1M，尺寸为：<em>{{ info.banner_name == 1 ? '750X350' : '750X260' }}</em>px</p>                    
                </div>
            </div>
            <div class="form-group">
                            <label for="handle_type" class="col-xs-2 control-label">处理类型</label>
                            <div class="col-xs-3">
                                <select class="form-control item_link_type" name="handle_type" id="linkType">
                                    <option value="none" {{ bannerData['link_type'] == 'none' ? 'selected="selected"' : '' }}>不跳转</option>
                                    <option value="info" {{ bannerData['link_type'] == 'info' ? 'selected="selected"' : '' }}>内容详情</option>
                                    <option value="url" {{ bannerData['link_type'] == 'url' ? 'selected="selected"' : '' }}>内部打开网页</option>
                                    <option value="activity" {{ bannerData['link_type'] == 'activity' ? 'selected="selected"' : '' }}>跳转到活动详情</option>
                                    <option value="question" {{ bannerData['link_type'] == 'question' ? 'selected="selected"' : '' }}>跳转到问答详情</option>
                                    <option value="beautyParlor" {{ bannerData['link_type'] == 'beautyParlor' ? 'selected="selected"' : '' }}>跳转到美容院详情</option>
                                    <option value="beautyCanon" {{ bannerData['link_type'] == 'beautyCanon' ? 'selected="selected"' : '' }}>跳转到宝典详情</option>
                                    <option value="beautyParlorService" {{ bannerData['link_type'] == 'beautyParlorService' ? 'selected="selected"' : '' }}>跳转到服务项目详情</option>
                                </select>
                            </div>
                        </div>
            
            <div class="form-group handle1">
                <label for="handle_data" class="col-xs-2 control-label">处理数据</label>
                <div class="col-xs-9">
            		<input id="linkData" type="text" class="form-control item_link_data" placeholder="" value="{{data['data']}}" name="handle_data">
                </div>
           </div>
           <div class="form-group handle2">
                <label for="handle_data" class="col-xs-2 control-label">内容详情</label>
                <div class="col-xs-9">
                    <textarea id="editor" name="handle_info" rows="15" style="height:300px;" data-rule="" >{{data['info']}}</textarea>
                </div>
           </div>
           <div class="form-group">
                <div class="col-xs-12 text-center">
                    <button id="btn_save" type="submit" class="btn btn-primary"><i class="fa fa-floppy-o fa-lg"></i> 保 存</button>
                </div>
            </div>             
            
            
        </form>
{% endblock %}